<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <!-- MOTW-DISABLED saved from url=(0014)about:internet -->
    <title>Build a data set</title>
    <link rel="StyleSheet" href="css/getstarted.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="css/webworks.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="webworks.css" type="text/css" media="all" />
    <script type="text/javascript" language="JavaScript1.2">
      <!--
        var  WebWorksRootPath = "";
      // -->
    </script>
  </head>
  <body>
    <div style="text-align: left;">
      <table cellspacing="0" summary="">
        <tr>
          <td>
            <a href="gs-TutT3BuildADataSource.html"><img src="images/prev.gif" alt="Previous" border="0" /></a>
          </td>
          <td>
            <a href="gs-TutT5LayOutTheReport.html"><img src="images/next.gif" alt="Next" border="0" /></a>
          </td>
        </tr>
      </table>
    </div>
    <hr align="left" />
    <blockquote>
      <h3 class="N_TutorialTask">Task 4:&nbsp;&nbsp;<a name="138709">Build a data set</a></h3>
      <p class="b_Body"><a name="138712">Now, you are ready to build your data set. A data set identifies the data to retrieve from the data source. If your report connects to a JDBC data source, such as the sample database, you use a SQL SELECT statement to specify the data to retrieve. </a></p>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">1&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138716">In Data Explorer, right-click Data Sets, and choose New Data Set from the context menu.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">2&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138718">In New Data Set, in Data Set Name, type the following text, as shown in </a><a href="#191358" title="Build a data set">Figure&nbsp;1-11</a>:</div>
            </td>
          </tr>
        </table>
      </div>
      <div class="cfi_CodeFirstIndent"><a name="186520">Customers</a></div>
      <p class="i2_Image2"><a name="138722"><img class="Default" src="images/tut_newdataset.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-11 New Data Set" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;1-11&nbsp;&nbsp;</b><a name="191358">New Data Set</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">3&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138726">Use the default values for the other fields.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="b2_Bullet2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="b2_Bullet2_inner" style="width: 14.1732pt; white-space: nowrap">
                <img src="Bullet.png" alt="*" border="0" width="6" height="6" />
              </div>
            </td>
            <td width="100%">
              <div class="b2_Bullet2_inner"><a name="138727">Data Source Selection shows the type and name of the data source that you created earlier.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="b2_Bullet2_outer" style="margin-left: 14.1732pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="b2_Bullet2_inner" style="width: 14.1732pt; white-space: nowrap">
                <img src="Bullet.png" alt="*" border="0" width="6" height="6" />
              </div>
            </td>
            <td width="100%">
              <div class="b2_Bullet2_inner"><a name="138728">Data Set Type indicates that the data set uses a SQL SELECT query.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">4&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138729">Choose Next.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_i_Indent1"><a name="345593">The Query page displays information to help you create a SQL query. Available Items lists all the schemas in the data source, including CLASSICMODELS, which you use for this tutorial and other reports you want to create with the sample database. You can click the plus (+) sign next to CLASSICMODELS to display the tables. The text area on the right side of this dialog shows the following required keywords of a SQL SELECT statement:</a></div>
      <div class="cfi_CodeFirstIndent"><a name="179741">select</a></div>
      <div class="coi_CodeIndent"><a name="179745">from</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">5&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="138733">In the text area, type the following SQL SELECT statement to specify the data to retrieve:</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="cfi_CodeFirstIndent"><a name="138735">select customerName,</a></div>
      <div class="coi_CodeIndent"><a name="138736">contactLastName,</a></div>
      <div class="coi_CodeIndent"><a name="138737">contactFirstName,</a></div>
      <div class="coi_CodeIndent"><a name="138738">phone</a></div>
      <div class="coi_CodeIndent"><a name="138739">from Customers</a></div>
      <div class="N_i_Indent1"><a name="177871">Although the data set editor shows table and column names in uppercase letters, you can type these names in the case you prefer because SQL is not case-sensitive. If you do not want to type the query, you can drag columns and tables from Available Items to the text area.</a></div>
      <div class="N_i_Indent1"><a name="138740">The SELECT statement that you created, which is shown in </a><a href="#449953" title="Build a data set">Figure&nbsp;1-12</a>, gets values from the CUSTOMERNAME, CONTACTLASTNAME, CONTACTFIRSTNAME, and PHONE columns in the CUSTOMERS table. </div>
      <p class="i2_Image2"><a name="138744"><img class="Default" src="images/editdataset02.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-12 SQL SELECT statement in Edit Data Set" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;1-12&nbsp;&nbsp;</b><a name="449953">SQL SELECT statement in Edit Data Set</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">6&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="449955">Choose Finish to save the data set. If you typed the query correctly, Edit Data Set appears. If you made a mistake, an error message appears before Edit Data Set opens. Edit Data Set displays the columns you specified in the query, and provides options for editing the data set.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">7&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="344531">Choose Preview Results to make sure the query is valid and that it returns the correct data. </a><a href="#191362" title="Build a data set">Figure&nbsp;1-13</a> shows some of the data rows that the query returns.</div>
            </td>
          </tr>
        </table>
      </div>
      <p class="i2_Image2"><a name="180763"><img class="Default" src="images/previewresults.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 1-13 Data rows returned by a SQL SELECT statement" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;1-13&nbsp;&nbsp;</b><a name="191362">Data rows returned by a SQL SELECT statement</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732pt; white-space: nowrap">
                <span class="zAuto_0023Format">8&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="180765">Choose OK.</a></div>
            </td>
          </tr>
        </table>
      </div>
    </blockquote>
    <hr align="left" />
    <table align="right" summary="">
      <tr>
        <td class="WebWorks_Company_Name_Bottom">
          <a href="notices.html">(c) Copyright Actuate Corporation 2013</a>
        </td>
      </tr>
    </table>
  </body>
</html>